<template>
	<view>
		<my-header :title="title" :back="true"></my-header>
		<uni-card class='cardList' style="margin-top: 80px;">
			<uni-row >
				<uni-col :span='8'>企业名称:</uni-col>
				<uni-col :span="16">{{form.enterpriseName}}</uni-col>
			</uni-row>
			<uni-row>
				<uni-col :span='8'>诉求类型:</uni-col>
				<uni-col :span="16">{{form.demandTypeName}}</uni-col>
			</uni-row>
		<!-- 	<uni-row>
				<uni-col :span='8'>诉求标题:</uni-col>
				<uni-col :span="16">{{form.demandTitle}}</uni-col>
			</uni-row> -->
			<uni-row>
				<uni-col :span='8'>诉求内容:</uni-col>
				<uni-col :span="16">{{form.demandContent}}</uni-col>
			</uni-row>
			<uni-row>
				<uni-col :span='8'>提交人:</uni-col>
				<uni-col :span="16">{{form.submitter}}</uni-col>
			</uni-row>
			<uni-row>
				<uni-col :span='8'>附件:</uni-col>
				<uni-col :span="16">
					<view v-for="(item,index) in form.files" :key="index">
						<image
						style="width: 100px; height: 100px; background-color: #eeeeee;" 
						:src="src + item"></image>
					</view>					
				</uni-col>
			</uni-row>
		</uni-card>
		<uni-card class='cardList' title="处理日志">
			<!-- <uni-list>
				<uni-list-item
				v-for="(item, index) in form.demandLogList"
				 :title="item.operater + ' ' + item.operation + (item.operation == '流转诉求' ? '至 ' : '') + (item.receiver ? item.receiver : '')" 
				 :note="item.remark ? ('回复：' + item.remark) : ''"
				 :rightText="item.time">				
				</uni-list-item>
			</uni-list> -->
			<view v-for="(item, index) in form.demandLogList">
				<uni-row style="padding: 12px 5px; border-bottom: 0.5px solid #e1e1e1;">
					<uni-col :span='14' style="font-size14px; color: #3b4144">{{item.operater + ' ' + item.operation + (item.operation == '流转诉求' ? '至 ' : '') + (item.receiver ? item.receiver : '')}}</uni-col>
					<uni-col :span='10' style="font-size: 12px; color: #999; text-align: end;">{{item.time}}</uni-col>
					<uni-col :span='24'>{{item.remark ? ('回复：' + item.remark) : ''}}</uni-col>
					<uni-col :span='24' v-for="item2 in item.attachments">
						<a :href="src + item2.filePath" target="_blank">{{item2.fileName}}</a>
					</uni-col>
				</uni-row>
				
			</view>
		</uni-card>
	</view>
</template>

<script>
	import MyHeader from '@/components/header.vue'
	export default {
		components: {
			MyHeader,
		},
		data() {
			return {
				title: '诉求详情',
				form: {},
				id: null,
				shuangfengData: null,
				src: window.location.href.split('#')[0] + '/sf_enterprise_service/data/upload/'
			}
		},
		onLoad: function (option) { //option为object类型，会序列化上个页面传递的参数
			console.log(option); //打印出上个页面传递的参数。
			this.showMore(option.id)
		},
		methods: {
			showMore(demandId) {
				uni.showLoading({
					title: '加载中'
				});
				uni.request({
					url: '/sf_enterprise_service/business/anondemand/info/' + demandId,
					// data: this.customFormData,
					method: 'GET',
					success: (res) => {		
						console.log(res, 'res?detail')
						this.form = res.data.data
						if(this.form.files.length) {
							this.form.files = this.form.files.split(',')
						}
						
						console.log(this.form, 'this.form')
					},
					complete: () => {							
						uni.hideLoading();
					}
				})
				console.log(demandId, 'moremore')
			},
			backIndex() {
				uni.navigateBack({
					delta: 1
				});
			},
		}
	}
</script>

<style>
.noHis {
	text-align: center;
}
.uni-icons{
	z-index: 3;
	position: fixed;
	top: 15px;
	left: 15px;
}
</style>
